import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { lotinfoVO, lotinfoForm, lotinfoQuery } from '@/api/system/lotInfo/types';

/**
 * 查询停车场-信息列表
 * @param query
 * @returns {*}
 */

export const listlotinfo = (query?: lotinfoQuery): AxiosPromise<lotinfoVO[]> => {
  return request({
    url: '/system/lotInfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询停车场-信息详细
 * @param parkingLotId
 */
export const getlotinfo = (parkingLotId: string | number): AxiosPromise<lotinfoVO> => {
  return request({
    url: '/system/lotInfo/' + parkingLotId,
    method: 'get'
  });
};

/**
 * 新增停车场-信息
 * @param data
 */
export const addlotinfo = (data: lotinfoForm) => {
  return request({
    url: '/system/lotInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改停车场-信息
 * @param data
 */
export const updatelotinfo = (data: lotinfoForm) => {
  return request({
    url: '/system/lotInfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除停车场-信息
 * @param parkingLotId
 */
export const dellotinfo = (parkingLotId: string | number | Array<string | number>) => {
  return request({
    url: '/system/lotInfo/' + parkingLotId,
    method: 'delete'
  });
};

/**
 * 新增停车场时停车场下拉
 */
export const getlotdevice = () => {
  return request({
    url: '/system/lotInfo/getParkingLotDeviceList',
    method: 'get'
  });
};

/**
 * 新增停车场时停车场下拉
 */
export const getlotdevicebyid = (deviceId: string) => {
  return request({
    url: '/system/lotInfo/getParkingLotDeviceByDeviceId/' + deviceId,
    method: 'get'
  });
};
